package com.part2.business.function.Impl;

import com.part2.action.common.validator.Validator;
import com.part2.beans.Mark;
import com.part2.common.query.Page;
import com.part2.dao.common.BaseDao;
import com.part2.dao.function.MarkDao;

public class MarkServiceImpl implements com.part2.business.function.MarkService {

	private BaseDao<Mark,String> baseDao;
	private MarkDao markDao;
	
	
	public void setBaseDao(BaseDao<Mark, String> baseDao) {
		this.baseDao = baseDao;
	}

	public void setMarkDao(MarkDao markDao) {
		this.markDao = markDao;
	}

	public void addMark(Mark mark) {
		// TODO Auto-generated method stub
		baseDao.save(mark);
	}

	public void deleteMark(String id) {
		// TODO Auto-generated method stub
		if(Validator.isNotNull(id)){
			Mark mk = this.findMarkByPrimeKey(id);
			if(mk!=null)
				baseDao.delete(mk);
		}
	}

	public Page<Mark> findMark(Page<Mark> page) {
		// TODO Auto-generated method stub
		return markDao.findMark(page);
	}

	public Mark findMarkByPrimeKey(String id) {
		// TODO Auto-generated method stub
		return markDao.findMarkByPrimeKey(id);
	}

	public void updateMark(Mark Mark) {
		// TODO Auto-generated method stub
		baseDao.saveOrUpdate(Mark);
	}

}
